<?php
session_start();
include("load-settings.php");

if(!isset($_SESSION['user']))
	header("Location: login.php");

$user = mysql_real_escape_string($_SESSION['user']);
$result = mysql_query("SELECT * FROM user WHERE id = $user");
$row = mysql_fetch_array($result);

if($row['type'] != 2)
	header("Location: home.php");

$booster = mysql_real_escape_string($_POST['id']);
$username = mysql_real_escape_string($_POST['username']);
$paypal = mysql_real_escape_string($_POST['paypal']);
$level = mysql_real_escape_string($_POST['level']);
$max_claims = mysql_real_escape_string($_POST['max_claims']);
$duo_approved = mysql_real_escape_string($_POST['duo_approved']);
$claim_time_limit = mysql_real_escape_string($_POST['claim_time_limit']);

$result = mysql_query("SELECT * FROM user WHERE id = $booster");

if(mysql_num_rows($result) == 0)
	header("Location: edit-booster.php");

mysql_query("UPDATE user SET username = '$username', paypal = '$paypal', level = $level, max_claims = $max_claims, duo_approved = $duo_approved, claim_time_limit = $claim_time_limit WHERE id = $booster") or die(mysql_error());

header("Location: edit-booster.php");

?>